# -*- coding:utf-8 -*-
# -*- coding: utf-8 -*-
# coding:unicode_escape
from asyncio import sleep
import sys, os, time
from PySide6 import QtCore, QtWidgets, QtGui, QtStateMachine


class Example(QtWidgets.QWidget):

    def __init__(self):
        super().__init__()

        self.initUI()

    def initUI(self):
        self.button = QtWidgets.QPushButton("Start", self)
        self.button.clicked.connect(self.doAnim)
        self.button.move(30, 30)

        self.frame = QtWidgets.QWidget(self)
        self.frame.setStyleSheet("background-color: red")
        self.frame.resize(30, 50)

        self.resize(200, 200)
        self.setWindowTitle('Animation')
        self.show()

    def doAnim(self):
        self.anim = QtCore.QPropertyAnimation(self.frame, b"size")
        self.anim.setDuration(1000)
        self.anim.setStartValue(QtCore.QSize(30, 50))
        self.anim.setEndValue(QtCore.QSize(100, 50))
        self.anim.start()


if __name__ == "__main__":
    app = QtWidgets.QApplication([])
    ex = Example()
    ex.show()
    app.exec()
